#pragma once

#include <iostream>
#include <memory>
#include "Epoller.hpp"
#include "Socket.hpp"
#include "Connection.hpp"
#include "Common.hpp"

using namespace SocketModule;

// Listener 专门进行获取新连接
class Listener : public Connection
{
public:
    Listener(int port = defaultport)
    :_port(port), _listensock(std::make_unique<TcpSocket>())
    {
        _listensock->BuildTcpSocketMethod(_port);
        SetEvent(EPOLLIN); //ET todo
        SetFd(_listensock->Fd());
    }
    ~Listener()
    {}
    void Recver()
    {
        //accept
    }
    void Sender(){}
    void Excepter(){}
private:
    int _port;
    std::unique_ptr<Socket> _listensock;
};